//
//  Community.m
//  Four_Fit
//
//  Created by lanou on 16/7/13.
//  Copyright © 2016年 xmaz. All rights reserved.
//

#import "Community.h"
#import "comment.h"

@implementation Community

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
    
    if ([key isEqualToString:@"id"]) {
        [self setValue:value forKey:@"ID"];
    }
    
}

- (CGFloat)cellHeight {
    
    if (!_cellHeight) {

        
            if (_items.count == 1) {
                
                _commentViewH = 60;
            } else if (_items.count == 2 || _items.count == 3) {
                _commentViewH = 90;
            } else {
                _commentViewH = 0;
            }
            
            if (_pic.count == 1) {
                
                _pictureViewFrame = CGRectMake(20, 190, kWidth - 40, kWidth - 30);
                
                _cellHeight = 190 + kWidth - 20 + _commentViewH;
            } else if (_pic.count == 2) {
                
                _pictureViewFrame = CGRectMake(20, 190, kWidth - 40, 180);
                
                _cellHeight = 200 + 180 + _commentViewH;
                
            } else if (_pic.count == 3) {
                
                _pictureViewFrame = CGRectMake(20, 190, kWidth - 40, 120);
                
                _cellHeight = 230 + 120 + _commentViewH;
            }
            
            
        }
        
    
    
    
    return _cellHeight;
}


@end
